﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Fire : MonoBehaviour {

    public Transform prefabBullet;
    bool action = false;
    // Use this for initialization
    void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
        if (Input.GetButtonDown("Jump"))
        {
            action = true;
            var bullet = Instantiate(prefabBullet, transform.position, transform.rotation,null);
            Debug.Log(bullet.forward);
            var rigid = bullet.GetComponent<Rigidbody>();
            Vector3 dir = bullet.localToWorldMatrix*Vector3.up;
            rigid.AddForce(dir*200);
        }
    }
}
